﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DataTier;
using DataTier.Entities;
using BusinessLogic;

namespace DataServices
{
    [ServiceContract(Namespace = WCFSettings.Namespace)]
    [XmlSerializerFormat]
    public interface IOrdersService
    {

        /// <summary>
        /// Возвращает список Заказов, в которых существуют неотгруженные товары
        /// </summary>
        /// <param name="currentUserId"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(ExceptionDetail))]
        List<OrderEntity> GetNotShippedGoodsOrderList(int currentUserId);


        /// <summary>
        /// Возвращает список неотгруженных товаров с их количеством
        /// </summary>
        /// <param name="currentUserId"></param>
        /// <param name="param"></param>
        /// <param name="sortExpression"></param>
        /// <param name="direction"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(ExceptionDetail))]
        List<OrderSpec> GetNotShippedGoodsList(int currentUserId, SearchParameters param = null, string sortExpression = null, string direction = null);


        /// <summary>
        /// Возвращает объект Заказ
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(ExceptionDetail))]
        OrderEntity GetOrder(int currentUserId, int id);


        /// <summary>
        /// Возвращает список Заказов
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(ExceptionDetail))]
        List<OrderFullInfoEntity> GetOrderList(int currentUserId, bool onlyIts, int numPage, int onPage, SearchParameters parameters = null, string sortExpression = null, string direction = null);

        /// <summary>
        /// Возвращает общее количество Заказов
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(ExceptionDetail))]
        int? GetOrderListCount(int currentUserId, bool onlyIts, SearchParameters parameters = null);

        /// <summary>
        /// Сохраняет Заказ в базе данных
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(ExceptionDetail))]
        int SaveOrder(int currentUserId, OrderEntity newOrder);

        /// <summary>
        /// Удаление Закака из базы данных
        /// </summary>
        /// <param name="orderId"></param>
        [OperationContract]
        [FaultContract(typeof(ExceptionDetail))]
        void DeleteOrder(int currentUserId, int orderId);


    }
}
